<?php
/*
 * This class is used for common same function.
 */

class Model_Login extends Model_Base {

    protected $_name = 'tbl_login';
    protected $_primaryKey = 'lgn_id';
	
	public function FetchEntryById($id) {
		//echo 'in';exit;
        $select = $this->select()
                ->from(array("usr" => "tbl_login"), Array('lgn_id', 'lgn_email','lgn_fname','lgn_lname','lgn_zipcode','lgn_city','lgn_state','lgn_phone','lgn_address', 'lgn_active'))
                ->where("lgn_id = ?", $id);
                //->where("lgn_active!= 2");
        //echo $select;exit;
        $data = $this->fetchRow($select);
        if (!empty($data)) {
            return $data->toArray();
        } else {
            return array();
        }
    }
	
	 public function checkEmailExist($email) {
        $select = $this->select()
                ->from(array("usr" => "tbl_login"))
                ->where("lgn_email = ?", $email);
                //->where("lgn_active!= 2");
        //echo $select;exit;
        $data = $this->fetchRow($select);
        if (!empty($data)) {
            return $data->toArray();
        } else {
            return array();
        }
    }
}
